package com.yc.spring.mvc.entity;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.util.Date;

@Data
public class User {
    @NotNull(message = "用户名不能为空")
    @Length(min=2,max=10,message = "用户名不能为空")
    String name;
    @Min(value=18,message = "年龄不能低于18岁")
    @Max(80)
    int age;
    @Pattern(regexp = "男|女",message = "性别必须是男女")
    String gender;
    @Email
    String email;
//    @Future  验证日期必须是未来的日期
    @Past(message = "生日必须是过去的日期")
    Date birthday;
}
